#注册页面
from selenium.webdriver.common.by import By

from commond.Utils import ForumDriver

class ForumEnroll:
    driver=""
    url=""
    def __init__(self):
        self.driver=ForumDriver.driver
        self.url="http://127.0.0.1:9580/sign-up.html"
        self.driver.get(self.url)

    #注册页面检查
    def Check_Enroll(self):
        text=self.driver.find_element(By.CSS_SELECTOR,"#signUpForm > div > h2").text
        print(text)
        #用户名
        text1=self.driver.find_element(By.CSS_SELECTOR,"#signUpForm > div > div:nth-child(2) > label").text
        self.driver.find_element(By.CSS_SELECTOR, "#username").send_keys("mxj4")
        print(text1)
        #昵称
        text2=self.driver.find_element(By.CSS_SELECTOR,"#signUpForm > div > div:nth-child(3) > label").text
        self.driver.find_element(By.CSS_SELECTOR,"#nickname").send_keys("mxj4")
        print(text2)
        #密码
        text3=self.driver.find_element(By.CSS_SELECTOR,"#password").text
        self.driver.find_element(By.CSS_SELECTOR, "#password").send_keys("123")
        print(text3)
        #确认密码
        text4=self.driver.find_element(By.CSS_SELECTOR,"#signUpForm > div > div:nth-child(5) > label").text
        self.driver.find_element(By.CSS_SELECTOR,"#passwordRepeat").send_keys("123")
        print(text4)
        #同意协议
        self.driver.find_element(By.CSS_SELECTOR,"#policy").click()
        #按下注册按钮,返回登陆首页
        self.driver.find_element(By.CSS_SELECTOR,"#submit").click()


Enroll=ForumEnroll()
# Enroll.Check_Enroll()
